﻿@using Citi.Scheduler.Domain
@model IEnumerable<Citi.Scheduler.WebUi.Models.MachineModel>
<table class="table table-bordered table-striped" style="width: 600px">
    <tr>
        <th>
            HostName
        </th>
        <th valign="middle">
            Status
        </th>
        <th>
            Operating System
        </th>
        @*<th>
            RAM
        </th>*@
    </tr>
    @foreach (var item in Model)
    {
        <tr>
            <td>
                <img src="@Url.Content("~/Content/img/icons/Computer-icon.png")" alt="Machine"  style="width:32px;" />
                @if (item.Status == MachineStatus.Running)
                {
                    <img src="@Url.Content("~/Content/Images/Check.png")" alt="Machine" style="margin-top:20px;margin-left:-20px; width:20px;" />
                }
                else
                {
                    <img src="@Url.Content("~/Content/Images/deleteButton.png")" alt="Machine" style="margin-top:30px;margin-left:-22px; width:20px;" />
                }
                @Html.DisplayFor(modelItem => item.HostName)
            </td>
            <td valign="middle">
                @if (item.CurrentRoutineInProgress == null)
                {
                    <text>Free</text>
                }
                else
                {   
                    <text>@item.CurrentRoutineInProgress.Routine.Name</text>
                }
            </td>
            <td>
                @if (!string.IsNullOrWhiteSpace(item.OperatingSystemInformation))
                {
                    <text>@item.OperatingSystemInformation.Replace("Operating System: ", string.Empty).Split(new[] { "Version: " }, StringSplitOptions.RemoveEmptyEntries).First()</text>
                }
            </td>
          @*  <td>
                @if (!string.IsNullOrWhiteSpace(item.Ram))
                {
                    <text>@item.Ram</text>
                }
            </td>*@
            @*<td>
            @Html.DisplayFor(modelItem => item.HostName)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.LastShutDown)
        </td>
       
        <td>
            @Html.DisplayFor(modelItem => item.DiskFreeSpace)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.DiskSize)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.ProcessorInformation)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.OperatingSystemInformation)
        </td>
        <td>
            @Html.ActionLink("Edit", "Edit", new { id=item.Id }) |
            @Html.ActionLink("Details", "Details", new { id=item.Id }) |
            @Html.ActionLink("Delete", "Delete", new { id=item.Id })
        </td>*@
        </tr>
    }
</table>
